<?php
if (!defined("_INDEX")) { header("Location: /"); die; }

if (isset($_POST['type']) && $_POST['type'] == "post")
{
	$friendsCount = UV::readInt($_POST['friendsCount']);
	$commentsCount = UV::readInt($_POST['commentsCount']);
	$topicsCount = UV::readInt($_POST['topicsCount']);
	
	$friends = $comments = $topics = array();
	$onFriends = UV::readBool($route->POST("onFriends"));
	$onComments = UV::readBool($route->POST("onComments"));
	$onTopics = UV::readBool($route->POST("onTopics"));
	
	if ($onFriends || $onComments || $onTopics)
	{
		$reports = $db->sendQuery("insert into `reports` values (NULL,'".$user->getUserId()."','".time()."')");
		$report_id = mysql_insert_id();
		
		if ($onFriends)
		{
			$query = "insert into `friends` values ";
			for($i=0; $i<$friendsCount; $i++)
			{
				$friends[$i]['date'] = UV::readMQ($_POST['dateF_'.($i+1)]);
				$friends[$i]['time'] = UV::readMQ($_POST['timeF_'.($i+1)]);
				$friends[$i]['login'] = UV::readMQ($_POST['loginF_'.($i+1)]);
				$friends[$i]['sname'] = UV::readMQ($_POST['snameF_'.($i+1)]);
				$friends[$i]['name'] = UV::readMQ($_POST['nameF_'.($i+1)]);
				$friends[$i]['tname'] = UV::readMQ($_POST['tnameF_'.($i+1)]);
				$friends[$i]['domain'] = UV::readMQ($_POST['domainF_'.($i+1)]);
				$friends[$i]['sex'] = UV::readMQ($_POST['sexF_'.($i+1)]);
				$friends[$i]['age'] = UV::readInt($_POST['ageF_'.($i+1)]);
				$friends[$i]['city'] = UV::readInt($_POST['cityF_'.($i+1)]);
				$friends[$i]['area'] = UV::readInt($_POST['areaF_'.($i+1)]);
				$friends[$i]['street'] = UV::readMQ($_POST['streetF_'.($i+1)]);
				$friends[$i]['description'] = UV::readMQ($_POST['descriptionF_'.($i+1)]);
				$friends[$i]['comment'] = UV::readMQ($_POST['commentF_'.($i+1)]);
				$date = strtotime($friends[$i]['date']." ".$friends[$i]['time']);
				$query .= " (NULL,'$report_id','".$friends[$i]['login']."','".$friends[$i]['domain']."','".$friends[$i]['sname']."','".$friends[$i]['name']."','".$friends[$i]['tname']."','$date','".$friends[$i]['sex']."','".$friends[$i]['age']."','".$friends[$i]['city']."','".$friends[$i]['area']."','".$friends[$i]['street']."','".$friends[$i]['description']."','".$friends[$i]['comment']."')";
				if ($i < $friendsCount - 1)
					$query .= " ,";
			}
			$friendsQuery = $db->sendQuery($query);
		}
		if ($route->POST("onComments"))
		{
			$query = "insert into `comments` values ";
			for($i=0; $i<$commentsCount; $i++)
			{
				$comments[$i]['friend'] = UV::readMQ($_POST['friendC_'.($i+1)]);
				$comments[$i]['link'] = UV::readMQ($_POST['linkC_'.($i+1)]);
				$comments[$i]['comment'] = UV::readMQ($_POST['commentC_'.($i+1)]);
				$comments[$i]['ucomment'] = UV::readMQ($_POST['ucommentC_'.($i+1)]);
				$query .= " (NULL,'$report_id','".$comments[$i]['friend']."','".$comments[$i]['link']."','".$comments[$i]['comment']."','".$comments[$i]['ucomment']."')";
				if ($i < $commentsCount - 1)
					$query .= " ,";
			}
			$commentsQuery = $db->sendQuery($query);
		}
		if ($route->POST("onTopics"))
		{
			$query = "insert into `topics` values ";
			for($i=0; $i<$topicsCount; $i++)
			{
				$topics[$i]['friend'] = UV::readMQ($_POST['friendT_'.($i+1)]);
				$topics[$i]['link'] = UV::readMQ($_POST['linkT_'.($i+1)]);
				$topics[$i]['date'] = UV::readMQ($_POST['dateT_'.($i+1)]);
				$topics[$i]['title'] = UV::readMQ($_POST['titleT_'.($i+1)]);
				$topics[$i]['description'] = UV::readMQ($_POST['descriptionT_'.($i+1)]);
				$topics[$i]['comment'] = UV::readMQ($_POST['commentT_'.($i+1)]);
				$date = strtotime($topics[$i]['date']);
				$query .= " (NULL,'$report_id','".$topics[$i]['friend']."','".$topics[$i]['link']."','$date','".$topics[$i]['title']."','".$topics[$i]['description']."','".$topics[$i]['comment']."')";
				if ($i < $topicsCount - 1)
					$query .= " ,";
			}
			$topicsQuery = $db->sendQuery($query);
		}
	}
	
	require_once COORDINATOR.DS."head.php";
	
	if (!$reports)
		echo "<p style='color:red'>Ошибка отчета</p>";
	
	if ($route->POST("onFriends"))
	{
		if ($friendsQuery)
			echo "<p style='color:green'>".wordEnding($friendsCount,"Добавлен","Добавлено","Добавлено",false)." ".wordEnding($friendsCount,"друг","друга","друзей",true,false)."</p>";
		else
			echo "<p style='color:red'>Ошибка добавления друзей</p>";
	}
	if ($route->POST("onComments"))
	{
		if ($commentsQuery)
			echo "<p style='color:green'>".wordEnding($commentsCount,"Добавлен","Добавлено","Добавлено",false)." ".wordEnding($commentsCount,"комментарий","комментария","комментариев",true,false)."</p>";
		else
			echo "<p style='color:red'>Ошибка добавления комментариев</p>";
	}
	if ($route->POST("onTopics"))
	{
		if ($topicsQuery)
			echo "<p style='color:green'>".wordEnding($topicsCount,"Добавлена","Добавлено","Добавлено",false)." ".wordEnding($topicsCount,"статья","статьи","статей",true,false)."</p>";
		else
			echo "<p style='color:red'>Ошибка добавления статей</p>";
	}
	echo "<a href='".$_SERVER['REQUEST_URI']."'>Добавить еще</a>";
}
else
{
	require_once COORDINATOR.DS."head.php";
	?>
	
	<script type='text/javascript'>
	var friendsCount = 1;
	var commentsCount = 1;
	var topicsCount = 1;

	function hoverEvent(e){
		$(".blocks input,.blocks select,.blocks textarea").focus(function(){
			$(".hovered").removeClass("hovered");
			$(this).parents(".blocks").addClass("hovered");
		});
		$(".blocks input,.blocks select,.blocks textarea").blur(function(){
			$(".blocks").removeClass("hovered");
		});
	}
	
	function cityEvent(){
		$(".city").change(function(){
			var thisCity = $(this);
			$.ajax({
					url: "/coordinator/getarea?city="+$(this).val(),
					success: function(data){
						thisArea = thisCity.parent().next().next().children(".area");
						thisArea.children().remove();
						if (data != "")
						{
							cities = $.parseJSON(data);
							for (var i=0; i<cities.length; i++)
								thisArea.append("<option value='"+cities[i].area_id+"'>"+cities[i].name+"</option>");
						}
					}
			})
		});
	}
	
	$(document).ready(function(){
		
		hoverEvent();
		
		// вкл/выкл input'ы
		$(".onoff").change(function(){
			if ($(this).attr('checked') == "checked")
			{
				$(this).parents(".blocks").find("input:not(.onoff),select,textarea").removeAttr('disabled');
				$("#submit").removeAttr('disabled');
			}
			else
			{
				$(this).parents(".blocks").find("input:not(.onoff),select,textarea").attr('disabled','disabled');
				if ($("#onFriends").attr('checked') != "checked" && $("#onComments").attr('checked') != "checked" && $("#onTopics").attr('checked') != "checked")
					$("#submit").attr('disabled','disabled');
			}
		})
		
		// оключаем все input'ы
		$("input:not(.onoff):not(:hidden),select,textarea").attr('disabled','disabled');
		
		// клик на блоке
		$(".blocks").click(function(){
			if (!$(this).hasClass("hovered"))
				$(this).find("input:first").focus();
		})
		
		// вопрос
		$("#reportForm").submit(function(){
			return confirm("Отправить отчет?");
		});
		
		$("#addFriend").click(function(e){
			friendsCount++;
			var templateFriend = "<tr><td><label for='dateF_"+friendsCount+"'>Дата</label></td><td><input type='text' name='dateF_"+friendsCount+"' id='dateF_"+friendsCount+"' class='date' /></td>"+
				"<td><label for='timeF_"+friendsCount+"'>Время</label></td>"+
				"<td><input type='text' name='timeF_"+friendsCount+"' id='timeF_"+friendsCount+"' class='time' /></td></tr>"+
				"<tr><td><label for='snameF_"+friendsCount+"'>Фамилия</label></td><td colspan='3'><input type='text' name='snameF_"+friendsCount+"' id='snameF_"+friendsCount+"' /></td></tr>"+
				"<tr><td><label for='nameF_"+friendsCount+"'>Имя</label></td><td colspan='3'><input type='text' name='nameF_"+friendsCount+"' id='nameF_"+friendsCount+"' /></td></tr>"+
				"<tr><td><label for='tnameF_"+friendsCount+"'>Отчество</label></td><td colspan='3'><input type='text' name='tnameF_"+friendsCount+"' id='tnameF_"+friendsCount+"' /></td></tr>"+
				"<tr><td><label for='loginF_"+friendsCount+"'>Логин</label></td>"+
				"<td colspan='2'><input type='text' name='loginF_"+friendsCount+"' id='loginF_"+friendsCount+"' /></td>"+
				"<td colspan='2'><select name='domainF_"+friendsCount+"' id='domainF_"+friendsCount+"' style='width:100%'>"+
				"<option value='mail'>@mail.ru</option><option value='inbox'>@inbox.ru</option><option value='bk'>@bk.ru</option><option value='list'>@list.ru</option></select></td></tr>"+
				"<tr><td><label for='sexF_"+friendsCount+"'>Пол</label></td>"+
				"<td><select name='sexF_"+friendsCount+"' id='sexF_"+friendsCount+"'><option value='undefined'>не известно</option><option value='male'>мужской</option><option value='female'>женский</option></select></td>"+
				"<td><label for='ageF_"+friendsCount+"'>Возраст</label></td><td><input type='text' name='ageF_"+friendsCount+"' id='ageF_"+friendsCount+"' style='width:50%' /> лет</td></tr>"+
				"<tr><td><label for='cityF_"+friendsCount+"'>Город</label></td><td><select class='city' name='cityF_"+friendsCount+"' id='cityF_"+friendsCount+"'>"+$("#cityF_1").html()+"</select></td>"+
				"<td><label for='areaF_"+friendsCount+"'>Район</label></td><td><select class='area' name='areaF_"+friendsCount+"' id='areaF_"+friendsCount+"'><option value='1'>Дзержинский</option><option value='2'>Ленинский</option><option value='3'>Промышленный</option><option value='4'>Центральный</option></select></td></tr>"+
				"<tr><td><label for='streetF_"+friendsCount+"'>Улица</label></td><td colspan='3'><input type='text' name='streetF_"+friendsCount+"' id='streetF_"+friendsCount+"' /></td></tr>"+
				"<tr valign='top'><td><label for='descriptionF_"+friendsCount+"'>Описание</label></td>"+
				"<td colspan='3'><textarea name='descriptionF_"+friendsCount+"' id='descriptionF_"+friendsCount+"' rows='5' style='width:100%'></textarea></td></tr>"+
				"<tr><td valign='top'><label for='commentF_"+friendsCount+"'>Ваш комментарий</label></td><td colspan='3'><textarea name='commentF_"+friendsCount+"' id='commentF_"+friendsCount+"' style='width:100%' rows='5'></textarea></td></tr>"+
				"<tr><td style='border-top:1px solid gray' colspan='4'></td></tr>";
			$("#friends table tr:not(.add):last").after(templateFriend);
			$("#friendsCount").val(friendsCount);
			hoverEvent();
			cityEvent();
			$(".date").datepicker(dateOptions);
			$(".time").keyup(track);
			e.stopPropagation();
		});
		
		$("#delFriend").click(function(e){
			if (friendsCount > 1){
				friendsCount--;
				$("#friends table tr:not(.add):last").remove();
				$("#friends table tr:not(.add):last").remove();
				$("#friends table tr:not(.add):last").remove();
				$("#friends table tr:not(.add):last").remove();
				$("#friends table tr:not(.add):last").remove();
				$("#friends table tr:not(.add):last").remove();
				$("#friends table tr:not(.add):last").remove();
				$("#friends table tr:not(.add):last").remove();
				$("#friends table tr:not(.add):last").remove();
				$("#friends table tr:not(.add):last").remove();
				$("#friends table tr:not(.add):last").remove();
				$("#friendsCount").val(friendsCount);
			}
			e.stopPropagation();
		});
		
		$("#addComment").click(function(e){
			commentsCount++;
			var templateComment = "<tr><td><label for='friendC_"+commentsCount+"'>Пользователь</label></td>"+
				"<td><input type='text' name='friendC_"+commentsCount+"' id='friendC_"+commentsCount+"' /></td></tr>"+
				"<tr><td><label for='linkC_"+commentsCount+"'>Ссылка на статью/комментарий</label></td>"+
				"<td><input type='text' name='linkC_"+commentsCount+"' id='linkC_"+commentsCount+"' /></td></tr>"+
				"<tr valign='top'><td><label for='commentC_"+commentsCount+"'>Комментарий</label></td>"+
				"<td><textarea name='commentC_"+commentsCount+"' id='commentC_"+commentsCount+"' rows='5' style='width:100%'></textarea></td></tr>"+
				"<tr><td valign='top'><label for='ucommentC_"+commentsCount+"'>Ваш комментарий</label></td><td colspan='3'><textarea name='ucommentC_"+commentsCount+"' id='ucommentC_"+commentsCount+"' style='width:100%' rows='5'></textarea></td></tr>"+
				"<tr><td style='border-top:1px solid gray' colspan='4'></td></tr>";
			$("#_comments table tr:not(.add):last").after(templateComment);
			$("#commentsCount").val(commentsCount);
			hoverEvent();
			e.stopPropagation();
		});
		
		$("#delComment").click(function(e){
			if (commentsCount > 1){
				commentsCount--;
				$("#_comments table tr:not(.add):last").remove();
				$("#_comments table tr:not(.add):last").remove();
				$("#_comments table tr:not(.add):last").remove();
				$("#_comments table tr:not(.add):last").remove();
				$("#_comments table tr:not(.add):last").remove();
				$("#commentsCount").val(commentsCount);
			}
			e.stopPropagation();
		});
		
		$("#addTopic").click(function(e){
			topicsCount++;
			var templateTopic = "<tr><td><label for='friendT_"+topicsCount+"'>Пользователь</label></td>"+
				"<td><input type='text' name='friendT_"+topicsCount+"' id='friendT_"+topicsCount+"' /></td></tr>"+
				"<tr><td><label for='linkT_"+topicsCount+"'>Ссылка на статью</label></td>"+
				"<td><input type='text' name='linkT_"+topicsCount+"' id='linkT_"+topicsCount+"' /></td></tr>"+
				"<tr><td><label for='dateT_"+topicsCount+"'>Дата создания</label></td>"+
				"<td><input type='text' name='dateT_"+topicsCount+"' id='dateT_"+topicsCount+"' class='date' /></td></tr>"+
				"<tr><td><label for='titleT_"+topicsCount+"'>Название</label></td>"+
				"<td><input type='text' name='titleT_"+topicsCount+"' id='titleT_"+topicsCount+"' /></td></tr>"+
				"<tr valign='top'><td><label for='descriptionT_"+topicsCount+"'>Описание</label></td>"+
				"<td><textarea name='descriptionT_"+topicsCount+"' id='descriptionT_"+topicsCount+"' rows='5' style='width:100%'></textarea></td></tr>"+
				"<tr><td valign='top'><label for='commentT_"+topicsCount+"'>Ваш комментарий</label></td><td><textarea name='commentT_"+topicsCount+"' id='commentT_"+topicsCount+"' style='width:100%' rows='5'></textarea></td></tr>"+
				"<tr><td style='border-top:1px solid gray' colspan='4'></td></tr>";
			$("#topics table tr:not(.add):last").after(templateTopic);
			$("#topicsCount").val(topicsCount);
			hoverEvent();
			$(".date").datepicker(dateOptions);
			e.stopPropagation();
		});
		
		$("#delTopic").click(function(e){
			if (topicsCount > 1){
				topicsCount--;
				$("#topics table tr:not(.add):last").remove();
				$("#topics table tr:not(.add):last").remove();
				$("#topics table tr:not(.add):last").remove();
				$("#topics table tr:not(.add):last").remove();
				$("#topics table tr:not(.add):last").remove();
				$("#topics table tr:not(.add):last").remove();
				$("#topics table tr:not(.add):last").remove();
				$("#topicsCount").val(topicsCount);
			}
			e.stopPropagation();
		});
		
		cityEvent();
	})
	</script>
	<form method="POST" id="reportForm">
		<input type='hidden' name='type' value='post' />
		<input type='hidden' id='friendsCount' name='friendsCount' value='1' />
		<input type='hidden' id='commentsCount' name='commentsCount' value='1' />
		<input type='hidden' id='topicsCount' name='topicsCount' value='1' />
		<div class='blocks' id="friends">
			<h3><input type='checkbox' class='onoff' id='onFriends' name='onFriends' /> Друзья</h3>
			<table cellpadding='0' cellspacing='5' style='width:600px;' border='0'>
				<tr>
					<td width="100px"><label for="dateF_1">Дата</label></td>
					<td width="200px"><input type='text' name='dateF_1' id='dateF_1' class='date' /></td>
					<td width="100px"><label for="timeF_1">Время</label></td>
					<td width="200px"><input type='text' name='timeF_1' id='timeF_1' class='time' /></td>
				</tr>
				<tr>
					<td colspan='2' class="hint"><span>Формат: 01.01.2011</span></td>
					<td colspan='2' class="hint"><span>Формат: 12:00</span></td>
				</tr>
				<tr>
					<td><label for="snameF_1">Фамилия</label></td>
					<td colspan='3'><input type='text' name='snameF_1' id='snameF_1' /></td>
				</tr>
				<tr>
					<td><label for="nameF_1">Имя</label></td>
					<td colspan='3'><input type='text' name='nameF_1' id='nameF_1' /></td>
				</tr>
				<tr>
					<td><label for="tnameF_1">Отчество</label></td>
					<td colspan='3'><input type='text' name='tnameF_1' id='tnameF_1' /></td>
				</tr>
				<tr>
					<td><label for="loginF_1">Логин</label></td>
					<td colspan='2'><input type='text' name='loginF_1' id='loginF_1' /></td>
					<td colspan='2'>
						<select name='domainF_1' id='domainF_1' style="width:100%">
							<option value='mail'>@mail.ru</option>
							<option value='inbox'>@inbox.ru</option>
							<option value='bk'>@bk.ru</option>
							<option value='list'>@list.ru</option>
						</select>
					</td>
				</tr>
				<tr>
					<td><label for="sexF_1">Пол</label></td>
					<td>
						<select name='sexF_1' id='sexF_1'>
							<option value='undefined'>не известно</option>
							<option value='male'>мужской</option>
							<option value='female'>женский</option>
						</select>
					</td>
					<td><label for="ageF_1">Возраст</label></td>
					<td><input type='text' name='ageF_1' id='ageF_1' style="width:50%" /> лет</td>
				</tr>
				<tr>
					<td><label for="cityF_1">Город</label></td>
					<td>
						<select class='city' name='cityF_1' id='cityF_1'><?php
							$oren = $db->getCell("select `city_id` from `cities` where `name` like 'Оренбург' limit 1");
							$not_in_ob = $db->getCell("select `city_id` from `cities` where `name` like 'Не в Оренбургской области' limit 1");
							$cities = $db->getTable("select * from `cities` where `city_id` != '$oren' and `city_id` != '$not_in_ob' order by `name`");
							echo "<option value='$not_in_ob'>Не в Оренбургской области</option>";
							echo "<option value='$oren'>Оренбург</option>";
							foreach($cities as $city)
								echo "<option value='$city[city_id]'>$city[name]</option>";
						?></select>
					</td>
					<td><label for="areaF_1">Район</label></td>
					<td>
						<select class='area' name='areaF_1' id='areaF_1'><?php
							/* $areas = $db->getTable("select * from `areas` order by `name`");
							foreach($areas as $area)
								echo "<option value='$area[area_id]'>$area[name]</option>"; */
						?></select>
					</td>
				</tr>
				<tr>
					<td><label for="streetF_1">Улица</label></td>
					<td colspan='3'><input type='text' name='streetF_1' id='streetF_1' /></td>
				</tr>
				<tr valign="top">
					<td><label for="descriptionF_1">Описание</label></td>
					<td colspan='3'><textarea name='descriptionF_1' id='descriptionF_1' rows='5' style="width:100%"></textarea></td>
				</tr>
				<tr>
					<td valign='top'><label for="commentF_1">Ваш комментарий</label></td>
					<td colspan='3'><textarea name='commentF_1' id='commentF_1' style='width:100%' rows='5'></textarea></td>
				</tr>
				<tr>
					<td style="border-top:1px solid gray" colspan='4'></td>
				</tr>
				<tr class="add">
					<td colspan='4' align="right">
						<label for="delFriend"></label><input type='button' id='delFriend' value="Удалить пользователя" style="width:170px;height:35px" />
						<label for="addFriend"></label><input type='button' id='addFriend' value="Добавить пользователя" style="width:170px;height:35px" />
					</td>
				</tr>
			</table>
		</div>
		<div class='blocks' id="_comments">
			<h3><input type='checkbox' class='onoff' id='onComments' name='onComments' /> Комментарии</h3>
			<table cellpadding='0' cellspacing='5' style='width:600px;' border='0'>
				<tr>
					<td width="200px"><label for="friendC_1">Пользователь</label></td>
					<td width="500px"><input type='text' name='friendC_1' id='friendC_1' /></td>
				</tr>
				<tr>
					<td colspan='2' class='hint'>Ссылка на страницу пользователя (например: <span class='important'>http://my.mail.ru/mail/user/</span>)</td>
				</tr>
				<tr>
					<td><label for="linkC_1">Ссылка на статью/комментарий</label></td>
					<td><input type='text' name='linkC_1' id='linkC_1' /></td>
				</tr>
				<tr valign="top">
					<td><label for="commentC_1">Комментарий</label></td>
					<td><textarea name='commentC_1' id='commentC_1' rows='5' style="width:100%"></textarea></td>
				</tr>
				<tr>
					<td valign='top'><label for="ucommentC_1">Ваш комментарий</label></td>
					<td><textarea name='ucommentC_1' id='ucommentC_1' style='width:100%' rows='5'></textarea></td>
				</tr>
				<tr>
					<td style="border-top:1px solid gray" colspan='4'></td>
				</tr>
				<tr class="add">
					<td colspan='2' align="right">
						<label for="delComment"></label><input type='button' id='delComment' value="Удалить комментарий" style="width:170px;height:35px" />
						<label for="addComment"></label><input type='button' id='addComment' value="Добавить комментарий" style="width:170px;height:35px" />
					</td>
				</tr>
			</table>
		</div>
		<div class='blocks' id="topics">
			<h3><input type='checkbox' class='onoff' id='onTopics' name='onTopics' /> Статьи</h3>
			<table cellpadding='0' cellspacing='5' style='width:600px;' border='0'>
				<tr>
					<td width="200px"><label for="friendT_1">Пользователь</label></td>
					<td width="500px"><input type='text' name='friendT_1' id='friendT_1' /></td>
				</tr>
				<tr>
					<td colspan='2' class='hint'>Ссылка на страницу пользователя (например: <span class='important'>http://my.mail.ru/mail/user/</span>)</td>
				</tr>
				<tr>
					<td><label for="linkT_1">Ссылка на статью</label></td>
					<td><input type='text' name='linkT_1' id='linkT_1' /></td>
				</tr>
				<tr>
					<td><label for="dateT_1">Дата создания</label></td>
					<td><input type='text' name='dateT_1' id='dateT_1' class="date" /></td>
				</tr>
				<tr>
					<td><label for="titleT_1">Название</label></td>
					<td><input type='text' name='titleT_1' id='titleT_1' /></td>
				</tr>
				<tr valign="top">
					<td><label for="descriptionT_1">Описание</label></td>
					<td><textarea name='descriptionT_1' id='descriptionT_1' rows='5' style="width:100%"></textarea></td>
				</tr>
				<tr>
					<td valign='top'><label for="commentT_1">Ваш комментарий</label></td>
					<td><textarea name='commentT_1' id='commentT_1' style='width:100%' rows='5'></textarea></td>
				</tr>
				<tr>
					<td style="border-top:1px solid gray" colspan='4'></td>
				</tr>
				<tr class="add">
					<td colspan='4' align="right">
						<label for="delTopic"></label><input type='button' id='delTopic' value="Удалить cтатью" style="width:170px;height:35px" />
						<label for="addTopic"></label><input type='button' id='addTopic' value="Добавить cтатью" style="width:170px;height:35px" />
					</td>
				</tr>
			</table>
		</div>
		<div class='blocks' id='send'><input type='submit' id="submit" value="Формировать отчет" style='width:200px;height:35px' /></div>
	</form><?php
}

require_once COORDINATOR.DS."footer.php";
?>